﻿''' <summary>
''' This class represents a plugin (collector/writer).
''' </summary>
''' <remarks></remarks>
Public Class Plugin

    ''' <summary>
    ''' Designates the plugin type.
    ''' </summary>
    ''' <remarks></remarks>
    Public Enum PluginType
        Writer = 0
        Collector = 1
    End Enum

    ''' <summary>
    ''' Path to plugin assembly.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_assembly As String

    ''' <summary>
    ''' Plugin class.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_class As String

    ''' <summary>
    ''' Path to plugin configuration.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_configuration As String

    ''' <summary>
    ''' Plugin type.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_type As PluginType

    ''' <summary>
    ''' Full name of plugin assembly.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_assemblyName As String

    ''' <summary>
    ''' Get/set the plugin assembly file.
    ''' </summary>
    ''' <value>Plugin assembly file.</value>
    ''' <returns>Plugin assembly file.</returns>
    ''' <remarks></remarks>
    Public Property AssemblyFile() As String
        Get
            Return m_assembly
        End Get
        Set(ByVal value As String)
            m_assembly = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the plugin class name.
    ''' </summary>
    ''' <value>Plugin class name.</value>
    ''' <returns>Plugin class name.</returns>
    ''' <remarks></remarks>
    Public Property ClassName() As String
        Get
            Return m_class
        End Get
        Set(ByVal value As String)
            m_class = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the plugin configuration file.
    ''' </summary>
    ''' <value>Plugin configuration file.</value>
    ''' <returns>Plugin configuration file.</returns>
    ''' <remarks></remarks>
    Public Property ConfigurationFile() As String
        Get
            Return m_configuration
        End Get
        Set(ByVal value As String)
            m_configuration = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the plugin type.
    ''' </summary>
    ''' <value>Plugin type.</value>
    ''' <returns>Plugin type.</returns>
    ''' <remarks></remarks>
    Public Property Type() As PluginType
        Get
            Return m_type
        End Get
        Set(ByVal value As PluginType)
            m_type = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the plugin assembly name.
    ''' </summary>
    ''' <value>Plugin assembly name.</value>
    ''' <returns>Plugin assembly name.</returns>
    ''' <remarks></remarks>
    Public Property AssemblyName() As String
        Get
            Return m_assemblyName
        End Get
        Set(ByVal value As String)
            m_assemblyName = value
        End Set
    End Property

    ''' <summary>
    ''' Default class constructor.
    ''' </summary>
    ''' <param name="AssemblyFile">Assembly file.</param>
    ''' <param name="ClassName">Class name.</param>
    ''' <param name="ConfigurationFile">Configuration file.</param>
    ''' <param name="Type">Plugin type.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal AssemblyFile As String, _
                   ByVal ClassName As String, _
                   ByVal ConfigurationFile As String, _
                   ByVal Type As PluginType)
        m_assembly = AssemblyFile
        m_class = ClassName
        m_configuration = ConfigurationFile
        m_type = Type
        m_assemblyName = ""
    End Sub

    ''' <summary>
    ''' Class constructor.
    ''' </summary>
    ''' <param name="AssemblyFile">Assembly file.</param>
    ''' <param name="ClassName">Class name.</param>
    ''' <param name="ConfigurationFile">Configuration file.</param>
    ''' <param name="Type">String representation of plugin type.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal AssemblyFile As String, _
                   ByVal ClassName As String, _
                   ByVal ConfigurationFile As String, _
                   ByVal Type As String)
        m_assembly = AssemblyFile
        m_class = ClassName
        m_configuration = ConfigurationFile
        If Type.ToLower() = "writer" Then
            m_type = PluginType.Writer
        Else
            m_type = PluginType.Collector
        End If
        m_assemblyName = ""
    End Sub

End Class
